﻿using Abp.Domain.Entities.Auditing;
using SingleUserMall.Orders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SingleUserMall.Refunds
{
    public class Refund : FullAuditedEntity<long>
    {
        /// <summary>
        /// 订单id
        /// </summary>
        public long OrderId { get; set; }
        [ForeignKey("OrderId")]
        public virtual Order Order { get; set; }
        /// <summary>
        /// 订单元素id
        /// </summary>
        public long OrderDetailId { get; set; }
        [ForeignKey("OrderDetailId")]
        public virtual OrderDetail OrderDetail { get; set; }
        /// <summary>
        /// 处理方式
        /// </summary>
        public RefundType Type { get; set; }
        /// <summary>
        /// 货物状态
        /// </summary>
        public ItemStatus? ItemStatus { get; set; }
        /// <summary>
        /// 退款编号
        /// </summary>
        [Required,MaxLength(50)]
        public string RefundNo { get; set; }
        /// <summary>
        /// 退款原因
        /// </summary>
        [MaxLength(100)]
        public string Reason { get; set; }
        /// <summary>
        /// 退款金额
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 返还金额
        /// </summary>
        public decimal? Profit { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 凭证
        /// </summary>
        public string Vouchers { get; set; }
        /// <summary>
        /// 退款状态
        /// </summary>
        public RefundStatus Status { get; set; }
        /// <summary>
        /// 关闭原因
        /// </summary>
        public string CloseReason { get; set; }
        /// <summary>
        /// 结束时间/关闭时间
        /// </summary>
        public DateTime? FinishTime { get; set; }
        /// <summary>
        /// 处理时间
        /// </summary>
        public DateTime? RefundTime { get; set; }
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; set; }
    }
}
